<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js">
<!--<![endif]-->

<head>
<meta charset="utf-8">
<title>转换线索</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1" name="viewport">
<meta content="" name="description">
<meta content="" name="autdor">
<script>BASE_URL ='${request.getContextPath()}'</script>
<link href="${request.getContextPath()}/Public/assets/admin/css/css.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css">

<link href="${request.getContextPath()}/Public/assets/global/css/components-rounded.css" id="style_components" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/css/plugins.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/admin/css/layout.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/admin/css/tdemes/default.css" rel="stylesheet" type="text/css" id="style_color">
<link href="${request.getContextPath()}/Public/assets/admin/css/custom.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker.min.css" rel="stylesheet" type="text/css">
<link href="${request.getContextPath()}/Public/assets/admin/css/common.css" rel="stylesheet" type="text/css">



<link rel="shortcut icon" href="${request.getContextPath()}/Public/favicon.ico">
<!--[if lt IE 9]>
<script src="${request.getContextPath()}/Public/assets/global/plugins/respond.min.js"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/excanvas.min.js"></script>
<![endif]-->
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery-migrate.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery.cokie.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>

<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery.sparkline.min.js" type="text/javascript"></script>

<script src="${request.getContextPath()}/Public/assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js" type="text/javascript"></script>

<script src="${request.getContextPath()}/Public/assets/global/scripts/metronic.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/admin/scripts/layout.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/admin/scripts/indexComponent.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/admin/scripts/commonUtils.js" type="text/javascript"></script>

<!-- 日起控件 -->
<script src="${request.getContextPath()}/Public/assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.zh-CN.min.js" type="text/javascript"></script>


<!-- 数据验证 -->
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery-validation/js/jquery.validate.js" type="text/javascript"></script>
<script src="${request.getContextPath()}/Public/assets/global/plugins/jquery-validation/js/localization/messages_zh.min.js" type="text/javascript"></script>
<link href="${request.getContextPath()}/Public/css/customerDetail.css" rel="stylesheet" type="text/css">
<!-- select2  begin -->
<script type="text/javascript" src="${request.getContextPath()}/Public/assets/global/plugins/select2/select2.js"></script>
<script type="text/javascript" src="${request.getContextPath()}/Public/assets/global/plugins/select2/select2_locale_zh-CN.js"></script>
<link href="${request.getContextPath()}/Public/assets/global/plugins/select2/select2.css" rel="stylesheet" type="text/css">
<script src="${request.getContextPath()}/Public/js/customerDetail/businessSel.js" type="text/javascript"></script>
<!-- select2 end -->
</head>
<body class="page-header-top-fixed">
<div class="page-header">
	<!--头部开始-->
	<#include "/include/top.html" />
	<!-- 头部信息结束 -->

	<!-- 头部菜单开始 -->
	<#include "/include/top_menu.html" />
	<!-- 头部菜单结束 -->
</div>
<!-- END HEADER -->
<div class="page-container">
	<div class="page-content">
		<div class="container-fluid">
		<ul class="page-breadcrumb breadcrumb">
				<li>
					<a href="#">首页</a><i class="fa fa-circle"></i>
				</li>
				<li class="active">
					 客户管理<i class="fa fa-circle"></i>
				</li>
				<li class="active">
					 线索池
				</li>
				<li class="active">
					 转换线索
				</li>
			</ul>
			<div class="row margin-top-10" wi>
				<div class="col-md-12">
				<form action="" name="conterfrom" id="conterfrom" method="post">
				
					<div class="portlet light bordered" align="center">
						 <h4 align="center" style="font-weight:bold;margin-bottom: 20px">主要信息</h4>
						<div class="table-scrollable">
							<input type="hidden" name="itemsId"  value="${itemsId}" />
							<input type="hidden" name="companyId" value="${company.id}" />
							<input type="hidden"  name="source" value="${source}" />
							<input type="hidden" value="${trailid}" name="trailid">
							
							<input type="hidden"  name="comanyName" id="comanyName" value="${company.name}"/>
							<table class="table table-striped table-bordered table-hover" id="myTable">
							
							<tr>
								<td scope="col" class="tdTitle" >
									<font color="red">*</font>负责人
								</td>
								<td>
								<select name="pic"     >
									<#list userlist as ulist >
									<option value="${ulist.id}" <#if ulist.id?? && company.userId?? && ulist.id==company.userId> selected</#if> >${ulist.name?html}</option>
			            				</#list>
			            		</select><font color="red">
			        				
								
								</td>
								<td scope="col"  class="tdTitle">
									<font color="red">*</font>来源
								</td>
								<td>
								
								<#if company.coo?? >
								
								${company.coo?html}
								</#if>
								
								
								
								</td>
								</tr>
								<tr>
								<td scope="col" class="tdTitle">
									<font color="red">*</font>公司名称
								</td>
								
								<td>
								<#if company.name?? >
								${company.name?html}
								
								
								</#if>
								</td>
								<td class="tdTitle">
									<font color="red">*</font>行业
								</td>
								<td>
								<#if company.salesProducts?? >
									<input  class="form-control" id="salesProducts"  value="${company.salesProducts?html}" name="salesProducts" style="min-width:240px;max-width:400px;height: 34px;"/>
									<#else>
									<input  class="form-control"   id="salesProducts" name="salesProducts" style="min-width:240px;max-width:400px;height: 34px;"/>
									
									</#if>
								</td>
								</tr>
								<tr>
								<td class="tdTitle">
									 <font color="red">*</font>客户级别
								</td>
								<td>
								<select name="level">
								<#list querycustom as sou>
								
								<option  value="${sou.id}" <#if  company.levelName??&& sou.name?? &&   company.levelName==sou.name> selected</#if>  >${sou.name?html}  </option>
								</#list>
								</select>
								
								
								
									
							
								</td>
								
								<td class="tdTitle"> <font color="red">*</font>省份</td>
								<td scope="col" >
								<div class="col-md-3" style="width:120px" >
								<select   style="width:100px " name="areaId" id="areaId" >
								<#list parent as par>
								
								<option  value="${par.id}" <#if  company.province??&& par.name?? &&   company.province==par.name> selected</#if>  >${par.name?html}  </option>
								</#list>
								</select></div>
								<div class="col-md-3" style="width:120px">
									<select    name="cityId" id="cityId" style="display:none;width:100px"></select>
								</div>
								</td>
								</tr>
								<tr>
								<td scope="col" class="tdTitle">
								
									<font color="red">*</font>企业类型   
								</td>
								<td>
							
								<#list qiyetypelist as sou>
								<input type="checkbox" name="entTypes" value="${sou.id}"  checked />${sou.name?html} 
								
								</#list>
								
								
								
								</td>
								
								<td scope="col" class="tdTitle">
									<font color="red">*</font> 地址
								</td>
								<td>
								<#if company.address?? >
								<input type="text" class="form-control"   id="address"  name="address" value="${company.address?html}"    />
								<#else>
								<input type="text" class="form-control"    id ="address" name="address"    />
								</#if>
								</td>
								</tr>
								<tr>
								<td scope="col" class="tdTitle">
								
									<font color="red">*</font>年销售额 
								</td>
								<td>
								<select id="salesVolume" name="salesVolume">
								
								<#list yearmoneylist as sou>
								
								<option  value="${sou.id}"  <#if  company.salesVolumeName?? && sou.name?? &&   company.salesVolumeName==sou.name> selected</#if>  >${sou.name?html}  </option>
								</#list>
								</select>	
								</td>
								<td scope="col" class="tdTitle">
									<font color="red">*</font> 员工人数
								</td>
								<td>
								<select name="categoryEmployee">
								<#list usercountlist as sou>
								
								<option  value="${sou.id}" <#if  company.employee ?? && sou.name?? &&  company.employee==sou.name> selected</#if> >${sou.name?html}  </option>
								</#list>
								</select>	
								
								</td>
								</tr>
								<tr>
								<td scope="col" class="tdTitle">
								<font color="red">*</font>	采购商品
								</td>
								<td>
								<#if company.buyProducts?? >
								<input type="text" class="form-control" id="buyProducts"  name="buyProducts" value="${company.buyProducts?html}" style="min-width:240px;max-width:400px;height: 34px;"/>
								<#else>
								<input type="text" class="form-control" id="buyProducts" name="buyProducts"  style="min-width:240px;max-width:400px;height: 34px;"/>
								</#if>
								</td>
								<td class="tdTitle">
									<font color="red">*</font>采购周期
								</td>
								<td>
								<select name="categoryFreq">
								<#list caigouzhouqi as sou>
								
								<option  value="${sou.id}" <#if  company.freq ?? && sou.name?? &&  company.freq==sou.name> selected</#if> >${sou.name?html}  </option>
								</#list>
								</select>
								
								</td>
								</tr>
								<tr>
								<td scope="col" class="tdTitle">
									<font color="red">*</font>采购量
								</td>
								<td>
								<#if company.buyVolume??>
								<input type="text" name="buyVolume"   id="buyVolume"  class="form-control"  value="${company.buyVolume?c}"  >
								<#else>
								<input type="text" name="buyVolume"    id="buyVolume"  class="form-control"  >
								</#if>
								</td>
								<td scope="col" class="tdTitle">
								
									<font color="red">*</font>采购品牌
								</td>
								<td>
								<#if company.buyBrand?? >
								<input type="text" name="buyBrand" id="buyBrand" class="form-control"  value="${company.buyBrand?html}"   style="min-width:240px;max-width:400px;height: 34px;">
								<#else>
								<input type="text" name="buyBrand"   id="buyBrand"  class="form-control"   style="min-width:240px;max-width:400px;height: 34px;"/>
								</#if>
								</td>
								</tr>
								<tr>
								
								<td scope="col" class="tdTitle">
									<font color="red">*</font>上下家
								</td>
							
								
								<td>
									<input type="checkbox"  value="0"  name="categoryBusiness"  > 采购方
									<input type="checkbox"   value="1"  name="categoryBusiness"  > 供应商
								</td>
							</tr>
					
							
							</table>
						</div>
						
						 <h4 align="center" style="font-weight:bold; margin-top: 30px;margin-bottom: 20px">联系人信息</h4>
						
					
						
						
						
						
						
						<table id="lxrtable" class="table table-striped table-bordered table-hover">
						<#list conlist as con>
						<input type="hidden" name="concompany" value="${company.id}"/>
						<input type="hidden" name="conId" value="${con.id}"/>
						<tr> <td>
						<div class="table-scrollable">
							
							<table class="table table-striped table-bordered table-hover" id="myTable1">
								<tr>
								<td scope="col" class="tdTitle">
									<font color="red">*</font>姓名
								</td>
								<td>
								<#if con.name??>
								<input type="text" name="conname" class="form-control"     value="${con.name?html}" >
								<#else>
								<input type="text" name="conname" class="form-control"      >
								</#if>
								</td>
								<td scope="col" class="tdTitle">
									性别
								</td>
								<td class="tdContent">
								
								<select name="consex">
								<option value="0" <#if con.sex?? && con.sex==0>selected </#if> >男</option>
								<option value="1" <#if con.sex?? && con.sex==1>selected </#if> >女</option>
								</select>
								</td>
								</tr>
								<tr>
								<td scope="col" class="tdTitle">
									<font color="red">*</font>职位
								</td>
								<td>
								<#if con.position??>
								<input  class="form-control"    type="text" name="conposition"  class="form-control"  value="${con.position?html}"   />
								<#else>
								<input  class="form-control"    type="text" name="conposition"  class="form-control"     />
								</#if>
								</td>
								<td class="tdTitle">
									<font color="red">*</font>手机
								</td>
								<td>
								<#if con.mobilePhone??>
								<input  class="form-control"    type="text" name="conmobilePhone"  class="form-control"  value="${con.mobilePhone?html}" />
								<#else>
								<input  class="form-control"    type="text" name="conmobilePhone"  class="form-control"  />
								</#if>
								</td>
								</tr>
								<tr>
								<td class="tdTitle">
									 QQ
								</td>
								<td>
								<#if con.qq??>
								<input class="form-control"     type="text" name="conqq" value="${con.qq?html}"   />
								<#else>
								<input  class="form-control"    type="text" name="conqq"  class="form-control"  />
								</#if>
								</td>
								<td scope="col" class="tdTitle">
									固话
								</td>
								<td>
								<#if con.telephone??>
								<input  class="form-control"    type="text" name="contelephone"  class="form-control"  value="${con.telephone?html}" />
								<#else>
								<input  class="form-control"    type="text" name="contelephone"  class="form-control"   />
								</#if>
								</td>
								</tr>
								<tr>
								<td scope="col" class="tdTitle">
									邮箱
								</td>
								<td>
								<#if  con.email??>
								<input  class="form-control" type="text"     class="form-control"  name="conemail" value="${con.email?html}"   >
								<#else>
								<input  class="form-control" type="text"     class="form-control"  name="conemail"    >
								</#if>
								</td>
								<td scope="col" class="tdTitle">
									 是否是关键联系人
								</td>
								<td>
								<select name="conkeyPerson">
								<option value="0" <#if con.keyPerson?? && con.keyPerson==0> selected </#if> >不是 </option>
								<option value="1" <#if con.keyPerson?? && con.keyPerson==1>selected </#if> >是</option>
								</select>
								
								
								</td>
								</tr>
								<tr><td class="tdTitle">交易身份</td> <td colspan="3">
								<select name="contidentity">
								<option value="0" <#if con.tidentity?? && con.tidentity==0 > selected </#if>   >采购</option>
								<option value="1" <#if con.tidentity?? && con.tidentity==0 > selected </#if> >销售</option>
								<option value="2" <#if con.tidentity?? && con.tidentity==0 > selected </#if> >采购和销售</option>
								</select>			
								</td>    </tr>
						</table>
					</div>
					</td>
					</tr>
					</#list>
					</table>
					
					<p align="left"> <a href="javascript:void(0);" onclick="addlxr()"><font size="3" >+</font>添加联系人</a> 
					<a href="javascript:void(0);" onclick="delMore()"><font size="3" >—</font></a>
					</p>
					
					
					 <h4 align="center" style="font-weight:bold; margin-top: 30px;margin-bottom: 20px">附加信息</h4>
						<div class="table-scrollable">
							
							<table class="table table-striped table-bordered table-hover" id="myTable1">
								<tr>
								<td scope="col"  class="tdTitle" >
									法人
								</td>
								<td>
								<#if company.corporate ?? >
								<input class="form-control"     type="text" name="corporate" value="${company.corporate?html}" >
								<#else>
								<input class="form-control"     type="text" name="corporate"  >
								
								</#if>
								</td>
								<td scope="col" class="tdTitle" >
									注册时间
								</td>
								<td>
								<#if company.registerDate ?? >
								<input class="form-control"    type="text"  id="registerDate" name="registerDate"  value="${company.registerDate?string('yyyy-MM-dd HH:mm:ss')}" >
								<#else>
								<input class="form-control"    type="text" id="registerDate"  name="registerDate" />
								</#if>
								</td>
								</tr>
								<tr>
								<td scope="col" class="tdTitle">
									公司电话
								</td>
								<td>
								<#if company.companyPhone ?? >
								<input class="form-control"     type="text" name="companyPhone" value="${company.companyPhone?html}" >
								<#else>
								<input class="form-control"     type="text" name="companyPhone" />
								
								</#if>
								</td>
								<td class="tdTitle">
									<font color="red">*</font>企业性质
								</td>
								<td>
									<select name="companyProperty">
								<#list qiyexingzhi as sou>
								
								<option  value="${sou.id}"  <#if  company.property ?? && sou.name?? &&   company.property==sou.name> selected</#if>>${sou.name?html}  </option>
								<
								</#list>
								</select>
								</td>
								</tr>
								<tr>
								<td class="tdTitle">
									网址
								</td>
								<td>
								<#if company.companySite??>
								<input class="form-control"     type="text" name="companySite" value="${company.companySite?html}" >
								<#else>
								<input class="form-control"     type="text" name="companySite"  />
								</#if>
								</td>
								<td scope="col" class="tdTitle">
									税务登记证
								</td>
								<td>
								<#if company.taxNo ??>
								<input  class="form-control" type="text"    name="taxNo" value="${company.taxNo?html}" >
								<#else>
								<input  class="form-control" type="text"    name="taxNo"  >
								</#if>
								
								</td>
								</tr>
								<tr>
								<td scope="col" class="tdTitle">
									开户银行
								</td>
								<td>
								<#if company.bank ?? >
								<input  class="form-control" type="text"    name="bank" value="${company.bank?html}" >
								<#else>
								<input  class="form-control" type="text"    name="bank"  >
								</#if>
								</td>
								<td scope="col" class="tdTitle">
									银行账户
								</td>
								<td>
								<#if company.bankAccount?? >
								<input  class="form-control" type="text"    name="bankAccount" value="${company.bankAccount?html}" >
								<#else>
								<input  class="form-control" type="text"    name="bankAccount"  />
								</#if>
								</td>
								</tr>
								<tr>
								
								<td scope="col" class="tdTitle">
									企业信誉
								</td>
								<td>
								<select name="credit"  >
								<option value="0"   <#if company.categoryCredit??  &&  company.categoryCredit=0>  selected</#if> >好</option>
								<option value="1"   <#if company.categoryCredit??  &&  company.categoryCredit=1>  selected</#if> >中</option>
								<option value="2"   <#if company.categoryCredit??  &&  company.categoryCredit=2>  selected</#if> >差</option>
								</select>
								
								

								</td>
								<td scope="col" class="tdTitle">
									关联企业
								</td>
								<td>
								<#if company.companyAss?? >
								<input class="form-control"  type="text" name="companyAss"     value="${company.companyAss}?html" >
								<#else>
								<input class="form-control"  type="text" name="companyAss"      >
								</#if>
								</td>
								</tr>
								<tr>
								<td scope="col" class="tdTitle">
									营业执照
								</td>
								<td>
								<#if company.businessLicense?? >
							<input type="text" name="businessLicense" class="form-control"     value="${company.businessLicense}?html" >
							<#else>
							<input type="text" name="businessLicense" class="form-control"      >
                               </#if>
								</td>
								<td scope="col" class="tdTitle">
									营业执照到期时间
								</td>
								<td>
								<#if company.expiryTime ?? >
								<input class="form-control"   id="expiryTime"  type="text" name="expiryTime" value="${company.expiryTime?string('yyyy-MM-dd HH:mm:ss')}"   >
								<#else>
								<input class="form-control"   id="expiryTime"    type="text" name="expiryTime?html" />
								</#if>
								</td>
								</tr>
								<tr>
								<td scope="col"  class="tdTitle">
									备注
								</td>
								<td colspan="3">
								
								<#if company.commands ?? >
								<textarea rows="5"   cols=""  class="form-control"    name="commands"style="widtd: 400px;height: 100px;">
									${company.commands}
								
								</textarea>
								<#else>
								<textarea rows="5"   cols=""  class="form-control"    name="commands"style="widtd: 400px;height: 100px;">
									
								
								</textarea>
								
								</#if>
								</td>
								</tr>
								
						</table>
						
						
					</div>
					 
				</div>
				<div class="form-group" align="center" >
						    <div class="col-sm-offset-2 col-sm-10">
						   	 <button type="button"  id="savetButton" class="btn green pull-">
									  转换  <i class="m-icon-swapright m-icon-white"> </i>
								</button>&nbsp;&nbsp;&nbsp;
					
						    	<button id="Button"  onclick="javascript :history.back(-1);" type="button" class="btn green pull">
									返回 <i class="m-icon-swapright m-icon-white"></i>
								</button>
						     	<input type="checkbox" disabled="disabled" checked="checked"  value="1" /> <font size="2">同时更新（注册）商城用户</font>
						    </div>
						 </div>
				</form>
			</div>
		
		</div>
			
	</div>
</div>
</div>

<div style="display: none;" id="trmodel"> 

<div class="table-scrollable">
			<input type="hidden" name="company" value="${company.id}"/>
			<table class="table table-striped table-bordered table-hover" id="myTable1">
				<tr>
				<td scope="col"  class="tdTitle" >
					<font color="red">*</font>姓名
				</td>
				<td>
				<input type="text" class="form-control"  name="name" value=""  >
				</td>
				<td scope="col" class="tdTitle" >
					性别
				</td>
				<td>
			<select   name="sex">
			<option value="0" >男</option>
			<option value="1"  >女</option>
			</select>
				</td>
				</tr>
				<tr>
				<td scope="col" class="tdTitle" >
				<font color="red">*</font>	职位
				</td>
				<td>
				<input  class="form-control" type="text" name="position"     />
				</td>
				<td scope="col" class="tdTitle" > 
					<font color="red">*</font>手机
				</td>
				<td>
				<input class="form-control"  type="text" name="mobilePhone"   />
				</td>
				</tr>
				<tr>
				<td scope="col" class="tdTitle">
					 QQ
				</td>
				<td>
				<input class="form-control"  type="text" name="qq"    />
				</td>
				<td scope="col" class="tdTitle">
					固话
				</td>
				<td>
				<input class="form-control"  type="text" name="telephone"   />
				</td>
				</tr>
				<tr>
				<td scope="col" class="tdTitle">
					邮箱
				</td>
				<td>
				<input class="form-control"     type="text" name="email"    >
				</td>
				<td scope="col" class="tdTitle">
					 是否是关键联系人
				</td>
				<td >
				<select name="keyPerson">
				<option value="0" >不是</option>
				<option value="1" >是</option>
				</select>
								
					</td>
				</tr>
				<tr><td class="tdTitle">交易身份</td> <td colspan="3">
							<select name="tidentity">
								<option value="0"     >采购</option>
								<option value="1"  >销售</option>
								<option value="2" >采购和销售</option>
								</select>			
			</td> </tr>
		</table>
	</div>
<div id="success" style="display: none; ">
			<div style="widtd: 400px;height: 350px;">
				<h3>保存成功</h3>
			</div>
</div>

</div>
<!-- 底部开始 -->
<#include "/include/foot.html" />
<!-- 底部结束 -->
</body>
<script>
	
//select2使用需要预先定义的businessArr数组
var businessArr = ['salesProducts', 'buyBrand', 'buyProducts'];
jQuery(document).ready(function() {
	   
	  
	 $("#areaId").change(function () {  
		
         $.get("${request.getContextPath()}/TrailPoolPojo/getAreaByprovinceId/"+$("#areaId").val()+".do",{},function(data){ 
             if(data!=null){   
                 var result = "";
                  for(var obj in data)
                  {
                   result +="<option value='"+data[obj].id+"'>"+data[obj].name+"</option>";
                  }  
                  if(result!="")
                  {
                   $("#cityId").html(result);
                   $("#cityId").css("display","block");
                  }else
                  {
                    $("#cityId").html("<option value='0'></option>");
                   $("#cityId").css("display","none");
                  }
             }
         });
     }); 
	   
	   $("#companyid").select2({
		   language: "zh_CN",
        placeholder: "关键字搜索公司",//文本框的提示信息
        minimumInputLengtd: 2,//至少输入n个字符，才去加载数据
        type : "post",
        allowClear: true, //是否允许用户清除文本信息
        /* multiple:true,//多选属性 */
        ajax: { // instead of writing tde function to execute tde request we use Select2's convenient helper
     	   url : "${request.getContextPath()}/dealMake/queryCompany.do",
            dataType: 'json',//接收的数据类型
            data: function (term, page) {//在查询时向服务器端传输的数据
                return {
                    companyName: term, //联动查询的字符
                    page: 10 //一次性加载的数据条数
                };
            },
            results: function (data, page) { // parse tde results into tde format expected by Select2.
                // since we are using custom formatting functions we do not need to alter remote JSON data
                var realNames = new Array();    
                     for (var i = 0; i < data.lengtd; i++) {
                          realNames.push({id: data[i].id, text: data[i].name});
                   }
                return {results: realNames};
            }
        },
        formatResult: resultFormatResult, // omitted for brevity, see tde source of tdis page
        formatSelection: resultFormatSelection,  // omitted for brevity, see tde source of tdis page
        dropdownCssClass: "bigdrop", // apply css tdat makes tde dropdown taller
        escapeMarkup: function (m) { return m; } // we do not want to escape markup since we are displaying html in results
    });
	   $("#companyid2").select2({
		   language: "zh_CN",
        placeholder: "关键字搜索公司",//文本框的提示信息
        minimumInputLengtd: 2,//至少输入n个字符，才去加载数据
        type : "post",
        allowClear: true, //是否允许用户清除文本信息
        /* multiple:true,//多选属性 */
        ajax: { // instead of writing tde function to execute tde request we use Select2's convenient helper
     	   url : "${request.getContextPath()}/dealMake/queryCompany.do",
            dataType: 'json',//接收的数据类型
            data: function (term, page) {//在查询时向服务器端传输的数据
                return {
                    companyName: term, //联动查询的字符
                    page: 10 //一次性加载的数据条数
                };
            },
            results: function (data, page) { // parse tde results into tde format expected by Select2.
                // since we are using custom formatting functions we do not need to alter remote JSON data
                var realNames = new Array();    
                     for (var i = 0; i < data.lengtd; i++) {
                          realNames.push({id: data[i].id, text: data[i].name});
                   }
                return {results: realNames};
            }
        },
        formatResult: resultFormatResult, // omitted for brevity, see tde source of tdis page
        formatSelection: resultFormatSelection,  // omitted for brevity, see tde source of tdis page
        dropdownCssClass: "bigdrop", // apply css tdat makes tde dropdown taller
        escapeMarkup: function (m) { return m; } // we do not want to escape markup since we are displaying html in results
   		 });
	   
	   Metronic.init(); // init metronic core componets
	   Layout.init(); // init layout
	});
	
		$("#expiryTime").datepicker({
			 	language: "zh-CN",
		    autoclose: true,//选中之后自动隐藏日期选择框
		    clearBtn: true,//清除按钮
		    todayBtn: true,//今日按钮
		    format: "yyyy-mm-dd",//日期格式
		    //startDate:new Date()
		});
			
		$("#registerDate").datepicker({
		 	language: "zh-CN",
		autoclose: true,//选中之后自动隐藏日期选择框
		clearBtn: true,//清除按钮
		todayBtn: true,//今日按钮
		format: "yyyy-mm-dd",//日期格式
		//startDate:new Date()
		});

	recordDate();
	//初始化日期
	function recordDate() {
		var nowDate = new Date();
        //$('#date-picker').attr("date-date",nowDate.getFullYear()+"/"+parseInt(nowDate.getMontd()+1)+"/"+nowDate.getDate());
        $('.date-picker').datepicker({
    	    autoclose: true	   
    	});
        
        
	}
	
	$("#savetButton").bind("click",function(){
		
		var conlist=document.getElementsByName("conname");
		for(var j=0 ; j<conlist.length;j++){
			var name=conlist[j].value;
			if(name==null||""==name){
				
				alert("联系人名称不能为空");
				return;
			}
			
		}
		
		
		var list=document.getElementsByName("name");
		for(var i=0 ; i<list.length-1;i++){
			var name=list[i].value;
			if(name==null||""==name){
				
				alert("联系人名称不能为空");
				return;
			}
			
		}
		
		var mobilePhonelist=document.getElementsByName("mobilePhone");
		for(var i=0 ; i<mobilePhonelist.length-1;i++){
			var name=mobilePhonelist[i].value;
			if(name==null||""==name){
				
				alert("联系人电话不能为空不能为空");
				return;
			}
			
		}
		var conmobilePhonelist=document.getElementsByName("conmobilePhone");
		for(var i=0 ; i<conmobilePhonelist.length;i++){
			var name=conmobilePhonelist[i].value;
			if(name==null||""==name){
				
				alert("联系人电话不能为空不能为空");
				return;
			}
			
		}
		var positionlist=document.getElementsByName("position");
		for(var i=0 ; i<positionlist.length-1;i++){
			var name=positionlist[i].value;
			if(name==null||""==name){
				
				alert("联系人行业不能为空不能为空");
				return;
			}
			
		}
		var conpositionlist=document.getElementsByName("conposition");
		for(var i=0 ; i<conpositionlist.length;i++){
			var name=conpositionlist[i].value;
			if(name==null||""==name){
				
				alert("联系人行业不能为空不能为空");
				return;
			}
			
		}
		
		var companyName=document.getElementById("comanyName").value;
		
		var salesProducts=document.getElementById("salesProducts").value;
		var address=document.getElementById("address").value;
		var buyProducts=document.getElementById("buyProducts").value;
		var buyBrand=document.getElementById("buyBrand").value;
		
			if(salesProducts==null||salesProducts==""){
				
				alert("行业不能为空!");
				return;
			}	
			if(address==null||address==""){
				
				alert("地址不能为空!");
				return;
			}		
			if(buyProducts==null||buyProducts==""){
				
				alert("采购商品不能为空!");
				return;
			}
			if(buyBrand==null||buyBrand==""){
				alert("采购品牌不能为空!");
				return;
			}
			var reg = new RegExp("^[0-9]*$");
		       var obj = document.getElementById("buyVolume");
		       if(obj.value==null||obj.value==""){
		    	   alert("采购数量正整数!");
		           return ;  
		    	   
		       }
		       if(!reg.test(obj.value)){
		           alert("采购数量正整数!");
		           return ;
		       }
			
		       var categoryBusiness=document.getElementsByName("categoryBusiness");
				var cout=0;
				for(var a=0 ; a<categoryBusiness.length;a++){
					var name=categoryBusiness[a].checked;
				
					if(name){
						cout++;
						
					}
					
				}
				
				if(cout<1){
					alert("请选择上下家");
					return;
				}
		
		$.ajax({
			url : "${request.getContextPath()}/convertrail/addconver.do",
			type : "post",
			dataType:"json",
			async: false,
			data : $("#conterfrom").serialize(),
			success : function(result) {
			   if(result.code=="success"){
						alert(companyName+"已成功转换为你的客户！");				
			      		window.location.href="${request.getContextPath()}/purchase/getAll.do";
				}else if(result.code=="REPEAT") {
					alert("转换失败 ，一个企业有且只有一个关键联系人！");
		   		}else if(result.code=="CFKH"){
		   			alert("转换失败,一个企业的同个品目下只能有一个客户！");
		   			
		   		}else{
		   			alert(result);
		   			
		   		}
			   }
		});
	});
	

	
	function resultFormatResult(medata) {
        return medata.text; 
	} 
	      
	function resultFormatSelection(medata) {
	        return medata.text; 
	} 
	
	
	function quit(){
		
  		window.location.href="${request.getContextPath()}/TrailPoolPojo/getAllList.do";

	}
	
	var tblelen=document.getElementById("lxrtable").rows.length;
	 function addlxr() {
		  var tb = document.getElementById("lxrtable");
		  var td1 = document.getElementById("trmodel").innerHTML;
		  var myTR =tb.insertRow(); 
		  var myTD1=myTR.insertCell(0)
		  
		 var  html1=td1;  
	
		  myTD1.innerHTML=html1; 
		
		  
		 }
	 
	 function delMore(obj){
		  
		 var tb = document.getElementById("lxrtable");
		 
		 var len = tb.rows.length;
		 if(len>tblelen){
			 tb.deleteRow(len-1);
		 }
		 	 
	 }
	 
	 var brandEl;
	 function brandList(obj){
		 
		 brandEl = obj;
		 CommonUtils.editModal('${request.getContextPath()}/customer/brandlist.do?typeId=buyBrand&values='+encodeURI(encodeURI(obj.value)),600);
	 }
	
	 function salesProduct(obj){
		 brandEl = obj;
			 CommonUtils.editModal('${request.getContextPath()}/customer/brandlist.do?typeId=salesProducts&values='+encodeURI(encodeURI(obj.value)),600);
		 }
	 
	 function buyProduct(obj){
		 brandEl = obj;
		 CommonUtils.editModal('${request.getContextPath()}/customer/brandlist.do?typeId=buyProducts&values='+encodeURI(encodeURI(obj.value)),600);
	 }
	 function changeParent(){
			debugger;
		  var branlist=document.getElementsByName("bran");
			
			var name="";
			for(var a=0 ; a<branlist.length;a++){
				var ch=branlist[a].checked;
			
				if(ch){
					name+=branlist[a].value;
					if(a!=branlist.length){
						name+=",";
					}
				
				}
				
				branlist[a].checked=false;
				
			}
			if(name!=null&&name!=""&&name.length>0&&name.substring(name.length-1)==","){
				
				name=name.substring(0,name.length-1)
				}
			document.getElementById(document.getElementById("typeId").value).value="";
			document.getElementById(document.getElementById("typeId").value).value=name;
			name="";
			document.getElementById("typeId").id="";
		
		$(".close").click();
		
	}
</script>
</html>

